/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.DAO;

import com.Entity.Employee;
import com.Entity.EmployeeLanguages;
import com.Entity.EmployeeProjects;
import com.Entity.EmployeeTests;
import com.Entity.Project;
import com.Interface.DAOInterface;
import com.Interface.EmployeeInterface;
import com.Interface.EmployeeLanguageInterface;
import com.Interface.EmployeeProjectsInterface;
import com.Interface.EmployeeTestsInterface;
import com.Interface.ProjectInterface;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author Vi
 */
@Stateless
public class DAO implements DAOInterface{

    private ProjectInterface project;
    private EmployeeInterface employee;
    private EmployeeProjectsInterface employeeProjects;
    private EmployeeTestsInterface employeeTests;
    private EmployeeLanguageInterface employeeLanguages;
    private EntityManager entityManager;
    
    public DAO(){
        project = new ProjectDAO();
        employee = new EmployeeDAO();
        employeeProjects = new EmployeeProjectsDAO();
        employeeTests = new EmployeeTestsDAO();
        employeeLanguages = new EmployeeLanguageDAO();
        EntityManagerFactory factory = Persistence.createEntityManagerFactory("persistenceUnit");
        entityManager = factory.createEntityManager();
    }
    
    @Override
    public List<Project> getAllProjects() {
        return project.getAllProjects();
    }

    @Override
    public List<Employee> getAllEmployees() {
        return employee.getAllEmployees();
    }
    
    @Override
    public Employee getEmployee(int idEmployee) {
        return employee.getEmployee(idEmployee);
    }

    @Override
    public List<EmployeeProjects> getManagingProjects(int idEmployee) {
        return employeeProjects.getManagingProjects(idEmployee);
    }

    @Override
    public EmployeeTests getEmployeeTest(int idEmployee) {
        return employeeTests.getEmployeeTest(idEmployee);
    }
    
    @Override
    public List<EmployeeLanguages> getEmployeeLanguages(int idEmployee) {
        return employeeLanguages.getEmployeeLanguages(idEmployee);
    }

    @Override
    public List<EmployeeProjects> getCurrentProjects(int idEmployee) {
        return employeeProjects.getCurrentProjects(idEmployee);
    }

    @Override
    public void removeEmployeeById(Integer id) {
        employee.removeEmployeeById(id);
    }

    @Override
    public Employee addEmployee(Employee emp) {
        return employee.addEmployee(emp);
    }

    @Override
    public void addEmployeeTests(EmployeeTests emp) {
       employeeTests.addEmployeeTests(emp);
    }
    
    @Override
    public void updateEmployee(Employee emp) {
        employee.updateEmployee(emp);
    }

    @Override
    public void updateEmployeeTests(EmployeeTests emp) {
        employeeTests.updateEmploteeTest(emp);
    }

    @Override
    public void addEmployeeLanguages(List<EmployeeLanguages> employeeLanguages) {
        this.employeeLanguages.addEmployeeLanguages(employeeLanguages);
    }

    @Override
    public void updateEmployeeLanguages(int idEmployee, List<EmployeeLanguages> employeeLanguages) {
        this.employeeLanguages.updateEmploteeLanguages(idEmployee, employeeLanguages);
    }
    
}
